package com.company.calendar.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.company.calendar.entity.WorkdayRule;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 工作日规则Mapper接口
 * 
 * @author System
 * @since 1.0.0
 */
@Mapper
public interface WorkdayRuleMapper extends BaseMapper<WorkdayRule> {
    
    /**
     * 根据配置ID查找所有规则
     */
    @Select("SELECT * FROM workday_rules WHERE config_id = #{configId}")
    List<WorkdayRule> findByConfigId(@Param("configId") Long configId);
    
    /**
     * 根据配置ID删除所有规则
     */
    @Delete("DELETE FROM workday_rules WHERE config_id = #{configId}")
    void deleteByConfigId(@Param("configId") Long configId);
}
